<form action="cmsWebFile/doUploadIco?callbackType=closeCurrent&navTabId=cmsWebFile/list" method="post" autocomplete="off" enctype="multipart/form-data" class="pageForm required-validate" onsubmit="return iframeCallback(this, dialogAjaxDone)">
    <input type="hidden" name="_csrf" value="<@tools.csrfToken admin=true/>"/>
    <div class="pageFormContent" layoutH>
        <dl class="nowrap">
            <dt><@t.page 'icons'/>:</dt>
            <dd>
                <input name="filename" class="required" type="text" value="favicon.ico"/>
                <label><@t.page 'image_size'/></label>
                <select name="size" class="combox">
                    <option value="16">16*16</option>
                    <option value="32" selected="selected">32*32</option>
                    <option value="48">48*48</option>
                    <option value="64">64*64</option>
                    <option value="128">128*128</option>
                </select>
                <label class="overwrite hide"><input type="checkbox" name="overwrite" checked="checked"><@t.page 'upload.overwrite'/></label>
            </dd>
        </dl>
        <dl class="nowrap">
            <dt><@t.page 'file'/>:</dt>
            <dd>
                <div class="upload-wrap">
                    <input type="hidden" name="path" value="${path!}"/>
                    <input type="file" name="file" accept="image/*" class="valid" style="left: 0px;">
                    <input type="hidden" name="base64File"/>
                    <input type="hidden" name="originalFilename"/>
                    <div class="cutinput">
                        <input name="width" type="number" value="${width!128}"/>
                        <span>*</span>
                        <input name="height" type="number" value="${height!128}"/>
                    </div>
                </div>
            </dd>
        </dl>
    </div>
    <div class="formBar">
        <ul>
            <li><button type="submit" class="buttonActive" title="ctrl+s"><@t.page 'upload'/></button></li>
            <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
        </ul>
    </div>
</form>
<script>
$(".pageFormContent",$.pdialog.getCurrent()).on("change","input[type=file]",function(){
    if($(this).length && $(this)[0].files){
        $.ajax({
            url:'cmsWebFile/check',
            type: 'POST',
            dataType: "json",
            async: false,
            data: {
                fileNames : [$("input[name=filename]",$.pdialog.getCurrent()).val()],
                path : $("input[name=path]",$.pdialog.getCurrent()).val(),
                _csrf : $("input[name=_csrf]",$.pdialog.getCurrent()).val()
            },
            success: function (result) {
                if(true==result){
                    $('.overwrite').show();
                } else {
                    $('.overwrite').hide();
                }
            }
        });
    }
});
</script>